Xi-Language Reference: 3D Plot

    • axis3d (Manipulation of 3d axes)
    • gensurface (Generate a mesh from a surface)
    • line3d (Draws a line or (unfilled) polygon)
    • mesh3d (Draws an arbitrary mesh)
    • plot3d (General 3d plotting function)
    • surface3d (Draws an arbitrary surface)
    • triag3d (Draws filled triangles)
    • velocity_field3d (draws a velocity_field)

    axis3d (Manipulation of 3d axes)

    Parameters

              axis3d ( num = 0, range = {}, title = "", titleheight = 0.05, 
                       numheight = 0.05, sticklen = 0.02, lticklen = 0.01, 
                       inside = 0, outside = 0, nonum = 0, noticks = 0, 
                       all = 0, remove = 0, bottomfront = 0, bottomback = 0, 
                       bottomleft = 0, bottomright = 0, topfront = 0, 
                       topback = 0, topleft = 0, topright = 0, frontleft = 0, 
                       frontright = 0, fronttop = 0, frontbottom = 0, 
                       backleft = 0, backright = 0, backtop = 0, 
                       backbottom = 0, leftfront = 0, leftback = 0, 
                       lefttop = 0, leftbottom = 0, rightfront = 0, 
                       rightback = 0, righttop = 0, rightbottom = 0 )
    
              Types: num                    int
                     range                  double[]
                     title                  string
                     titleheight            double
                     numheight              double
                     sticklen               double
                     lticklen               double
                     inside                 int
                     outside                int
                     nonum                  int
                     noticks                int
                     all                    int
                     remove                 int
                     bottomfront            int
                     bottomback             int
                     bottomleft             int
                     bottomright            int
                     topfront               int
                     topback                int
                     topleft                int
                     topright               int
                     frontleft              int
                     frontright             int
                     fronttop               int
                     frontbottom            int
                     backleft               int
                     backright              int
                     backtop                int
                     backbottom             int
                     leftfront              int
                     leftback               int
                     lefttop                int
                     leftbottom             int
                     rightfront             int
                     rightback              int
                     righttop               int
                     rightbottom            int
    

    Return

              -1
    

    Description

    The axis3d function is mostly the same as the axis function in the two dimensional case, only that there are a lot of more possible axes to manipulate. Actually the axis3d has the most arguments (36) of all buildin Xi functions, but since most arguments are merely flag, this is a fake record.

    The num,range,title,titleheight,numheight, sticklin,lticklen,inside,outside,nonum, noticks,all and remove arguments have exactly the same meaning as in axis. The selection of the axis/axes to manipulate is a little more complicated. In the two dimensional case you have only four direcetions: top,bottom,left,right. In the three dimensional case you have the six sides of a cube and on each side four posible directions. The sides of the cube are labeled by top,bottom,left,right,front,back. To define on these sides a direction the you simply choose the side next to that direction. So righttop selects the right side of the cube and the direction next to the top side and so on.

    See also

    plot3d, plot, axis

    gensurface (Generate a mesh from a surface)

    Parameters

              gensurface ( z, x = {}, y = {} )
    
              Types: z                      double[]
                     x                      double[]
                     y                      double[]
    

    Return

              [int[],double[],double[],double[]]  (Containing the mesh)
    

    Description

    The gensurface function is an easy way to generate the input for the mesh3d function. The input to gensurface is similar to the contour function. If x and y are undefined z defines the graph of a function z=f(n,m) where n and m are the indexes of the z-array. When defining also x and y you are able to draw connected surfaces of arbitrary shape.

    See also

    mesh3d, surface3d, contour

    line3d (Draws a line or (unfilled) polygon)

    Parameters

              line3d ( x1 = {}, y1 = {}, z1 = {}, x1, y2, z2, color = -1 )
    
              Types: x1                     double/double[]
                     y1                     double/double[]
                     z1                     double/double[]
                     x1                     double
                     y2                     double
                     z2                     double
                     color                  int
    

    Return

              -1
    

    Description

    line3d is an interface for the plot3d function. If x1,y1 and z1 are simply numbers the parameters x2,y2 and z2 must also be specified. In this case line3d draws a straight line form x1,y1,z1 to x2,y2,z2 with the color color. If x1,y1 and z1 are arrays, x2,y2 and z2 should be left blank. In this case line3d acts the same way as the plot3d function with the line flag set.

    See also

    plot, line, plot3d

    mesh3d (Draws an arbitrary mesh)

    Parameters

              mesh3d ( indx, x, y, z, num = 0, color = -1, gridColor = -1, 
                       xrange = {}, yrange = {}, zrange = {}, position = {}, 
                       angle = {} )
    
              Types: indx                   int[]
                     x                      double[]
                     y                      double[]
                     z                      double[]
                     num                    int
                     color                  int
                     gridColor              int
                     xrange                 double[]
                     yrange                 double[]
                     zrange                 double[]
                     position               double[]
                     angle                  double[]
    

    Return

              -1
    

    Description

    The mesh3d function is of use, when you want to draw two dimensional surfaces of arbitrary shape. The x,y and z arguments define a set of points in three dimension space. The indx argument is a list of closed polygons in this set of points. Each polygon is defined by a number of points (actually <=4) followed by the indexes of the points. For example the indx-array may have the following contents:
        3 0 1 2  4 2 3 1 0
     
    This means that mesh3d should draw first a triangle from point 0 over point 1 to point 2 and second a closed polygon with edgepoints 2 3 1 0.

    The color arguments defines in which color the polygons should be filled. With the gridColor argument mesh3d optionally draws the boundary of each polygon, so a visible grid is layed over the surface.

    The num,xrange,yrange,zrange,position and angle arguments have the same meaning as in the plot3d function.

    See also

    plot, plot3d

    plot3d (General 3d plotting function)

    Parameters

              plot3d ( x = {}, y = {}, z = {}, color = -1, num = 0, 
                       xrange = {}, yrange = {}, zrange = {}, position = {}, 
                       angle = {}, line = 0, xtitle = "", xtitleheight = 0.05, 
                       ytitle = "", ytitleheight = 0.05, ztitle = "", 
                       ztitleheight = 0.05, numheight = 0.05 )
    
              Types: x                      double[]
                     y                      double[]
                     z                      double[]
                     color                  int
                     num                    int
                     xrange                 double[]
                     yrange                 double[]
                     zrange                 double[]
                     position               double[]
                     angle                  double[]
                     line                   int
                     xtitle                 string
                     xtitleheight           double
                     ytitle                 string
                     ytitleheight           double
                     ztitle                 string
                     ztitleheight           double
                     numheight              double
    

    Return

              -1
    

    Description

    The plot3d function acts in the same manner as the plot function in the two dimensional case, there is only one more coordinate. By defining x,y and z you set an arbitrary number of points at the given coordinates. With help of the line you may connect these points by lines, thus drawing a polygon in space. Not that there is actually no posibility to connect the points by a spline like in the two dimensional case.

    The color,xrange,yrange,zrange,xtitle, ytitle,ztitle,xtitleheight,ytitleheight, ztitleheight and numheight arguments have the same meanig as in the plot function. Also the position argument ist mostly the same, the only difference is that you have to define a cube by to points in space, thus the position array contains 6 elements.

    The angle argument is a 3d specific option. Since you can't change the viewing direction of the 3d graphic device, you may rotate the plot instead. The angle array contains 3 elements defining the Euler-angles of the plot. The first elements defines a rotation about the z-axis, the second a rotation about the y-axis and the last is again a rotation about the z-axis. A good choise is for example {60,30,-90}.

    See also

    plot

    surface3d (Draws an arbitrary surface)

    Parameters

              surface3d ( z, x = {}, y = {}, num = 0, color = -1, 
                          gridColor = -1, xrange = {}, yrange = {}, 
                          zrange = {}, position = {}, angle = {} )
    
              Types: z                      double[]
                     x                      double[]
                     y                      double[]
                     num                    int
                     color                  int
                     gridColor              int
                     xrange                 double[]
                     yrange                 double[]
                     zrange                 double[]
                     position               double[]
                     angle                  double[]
    

    Return

              -1
    

    Description

    surface3d is merely an interface to gensurface and mesh3d. First gensurface is called with arguments z,x,y and seconds the output is piped into mesh3d with aditional arguments num,xrange,yrange, zrange,position and angle (see plot and plot3d for detail).

    See also

    plot, plot3d, mesh3d, gensurface, contour

    triag3d (Draws filled triangles)

    Parameters

              triag3d ( x1, y1, z1, x2, y2, z2, x3, y3, z3, color = -1 )
    
              Types: x1                     double/double[]
                     y1                     double/double[]
                     z1                     double/double[]
                     x2                     double
                     y2                     double
                     z2                     double
                     x3                     double
                     y3                     double
                     z3                     double
                     color                  int
    

    Return

              -1
    

    Description

    triag3d is similar in use as the line3d function. If x1,y1 and z1 are simply numbers the parameters x2,y2,z2,x3,y3 and z3 must also be specified. In this case triag3d draws a triangle from x1,y1,z1 over x2,y2,z2 to x3,y3,z3 filled with color color. If x1,y1 and z1 are arrays, x2,y2,z2,x3,y3 and z3 should be left blank. In this case triag3d draws an arbitrary number of filled triangles eath defined by there points.

    See also

    line3d

    velocity_field3d (draws a velocity_field)

    Parameters

              velocity_field3d ( u, v, w, x = {-1}, y = {-1}, z = {-1}, 
                                 startX = {-1}, startY = {-1}, startZ = {-1}, 
                                 colors = {-1}, nstep = 1, stepSize = 0.1, 
                                 headScale = 0.5, noaxis = 0 )
    
              Types: u                      double[]
                     v                      double[]
                     w                      double[]
                     x                      double[]
                     y                      double[]
                     z                      double[]
                     startX                 double[]
                     startY                 double[]
                     startZ                 double[]
                     colors                 char[]
                     nstep                  int
                     stepSize               double
                     headScale              double
                     noaxis                 int
    

    Return

              -1
    

    Description

    velocity_field3d plots a velocity field with arrows pointing in the direction of the given velocity field. u, v and w give the X, Y and Z components of the 3 dimensional velocity field. If the parameters x, y and z are given the should be arrays. The size of z must be equal to the first dimension of u, v, w and y must be equal to the second dimension of u, v, w. At least the size of \x\ must be equal to the third dimension of u, v, w. startX, startY and startZ set the start points and the array color sets the colors of each arrow. nsteps changes the number of segments of each arrow and stepSize determine the number of segments. The parameter headScale is the proportional factor between the length of the arrow and sides of the arrow-head. Corresponding to the plot command the flag noaixs suppresses the axis.

    Example

    >u=replicate(cos(dincarr(4,4)/5.),4);
    >v=replicate(transpose(sin(dincarr(4,4)/5.)),4);
    >w=darr(4,4,4)+0.4
    >window(0,\t3d);
    >velocity_field3d(u,v,w);
    

    See also

    velocity_field
    © 1995 by Bodo Junglas, Klaus Spanderen and Fabian Weis
    - Last revised: Wed Jun 19 16:58:32 1996